//******************************************************** // Horizontal Sundial // NASS Sundial Design Tutorials // Part 1 Sundial Base // Robert L. Kellogg, Ph.D. // 1 Dec 2019 // // This design is part of the creative commons //******************************************************** /* We're going to create the base of a sundial. Three variation are given: a circular sundial and a dial base with 6 or 8 sides (hexagon or octagon). We'll make the sundial base with a slight taper of the sides. This is just a bit of simple esthetics. */ echo("Part-1 NASS Sundial Base"); //NASS Tutorial // ---------------------------------------------------- // --------------- Sundial Parameters ---------------- // ---------------------------------------------------- // Note: base units are in mm and angles in degrees shape = "octagon"; // "circular" dial base // "hexagon" dial base // "octagon" dial base dial_btm = 78; //dial base(~3") mm dial_top = 75; //dial base (taper top) mm dial_hght = 3; //dial base height mm // ---------------------------------------------------- // ------------ Main Program Starts Here ------------- // ---------------------------------------------------- if(shape=="circular") { echo("shape",shape); minangle = 3; sundial_base(minangle,turn=0); } if(shape=="octagon") { echo("shape",shape); minangle = 45; sundial_base(minangle,turn=45/2); } if(shape=="hexagon") { echo("shape",shape); minangle = 60; sundial_base(minangle,turn=0); } // ---------------------------------------------------- // ----------- Procedure Modules Start Here ----------- // ---------------------------------------------------- module sundial_base(mini,turn) { $fa = mini; rotate([0,0,turn]) //notice no ';' since rotate cylinder cylinder($fa,h=dial_hght,d1=dial_btm,d2=dial_top); //we use the built-in procedure called cylinder, using //the options to define a top and bottom size. //$fa sets the number of degrees for each cylinder segment // circular $fa=3, hexagon $fa=45, octagon $fa=60 //'center=false' still puts the cylinder center at xy = (0,0) //but the bottom of the cylinder rests at z=0 (that is, it //sets on the ground of the xy plane. //the size of the sundial base could have been passed as //variables, such as calling // sundial_base(dial_hght,dial_btm,dial_top,mini,turn); //and the procedure could be // sundial_base(hght,btm,top,mini,turn); //Notice that the rotate operator function occurs before the //object it acts upon. Hence rotate() appears in the line //above the cylinder object and has no ";". Only the object // cylinder(); gets the ";" }